  function i(e, o) {
    for (var t = 0; t < o.length; t++) {
      var a = o[t];
      (a.enumerable = a.enumerable || !1),
        (a.configurable = !0),
        "value" in a && (a.writable = !0),
        Object.defineProperty(e, a.key, a);
    }
  }
  Array.prototype.findIndex ||
    Object.defineProperty(Array.prototype, "findIndex", {
      value: function (e) {
        if (null == this) throw new TypeError('"this" is null or not defined');
        var o = Object(this),
          t = o.length >>> 0;
        if ("function" != typeof e)
          throw new TypeError("predicate must be a function");
        for (var a = arguments[1], n = 0; n < t; ) {
          var s = o[n];
          if (e.call(a, s, n, o)) return n;
          n++;
        }
        return -1;
      },
    }),
    Array.prototype.find ||
      (Array.prototype.find = function (e) {
        return e && (this.filter(e) || [])[0];
      }),
    window.ActiveXObject || "ActiveXObject" in window
      ? ($("body").addClass("ie"), console.log("呜呜呜,我是ie"))
      : console.log("不是ie,爱你哦"),
    $(document).ready(function () {
      try {
        $(".count-up").countUp({ time: 1300 });
      } catch (e) {
        console.log("该页面无countUp动画！", e);
      }
      $("aside.nav2-template > ul > li.has-children2 ul li i").click(
        function () {
          $(this).parent().children("ul").slideToggle(),
            $(this).toggleClass("active--rotate-right");
        }
      );
      var e,
        o,
        t = $("header .index-page.nav-box").css("top"),
        a = $(this).scrollTop();
      1210 < $(document).width() &&
        "0px" != t &&
        0 < a &&
        $("header .nav-box").addClass("top-0"),
        $(document).width() < 1210 &&
          "0px" != t &&
          0 < a &&
          ($("header .index-page.nav-box").addClass("top-0"),
          console.log("不是0")),
        $(document).scroll(function () {
          (e = $(window).scrollTop()),
            o <= e
              ? $(this).scrollTop() < 10
                ? $("header .index-page.nav-box").removeClass("top-0")
                : ($("header .nav-box").removeClass("nav-set-top-40"),
                  $("header .nav-box").addClass("nav-set-top"),
                  $("header .nav-box").addClass("top-0"))
              : e <= 10 &&
                ($(window).scrollTop() < 10 &&
                  ($("header .index-page.nav-box").removeClass("top-0"),
                  $("header .nav-box").removeClass("top-0")),
                $(document).width() < 1210
                  ? ($("header .nav-box").removeClass("nav-set-top"),
                    $("header .index-page.nav-box").addClass("nav-set-top-40"))
                  : ($("header .nav-box").removeClass("top-0"),
                    $("header .nav-box").removeClass("nav-set-top"),
                    $("header .nav-box").addClass("nav-set-top-40"))),
            (o = e);
        });
      try {
        new WOW().init();
      } catch (e) {
        console.log("当前页面无wow,但是没关系", e);
      }
      $(document).width() < 1300 &&
        (console.log("大于1200"),
        $("ul.nav1>li .products-down").click(function () {
          console.log($(this)),
            $(this).parent().children(".show-box").slideToggle(250);
        })),
        1300 < $(document).width()
          ? (console.log("大于1200"),
            $(".nav2-left>ul>li").click(function () {
              console.log(11), $(this).children("ul.nav3").slideToggle();
            }),
            $("header #search").click(function () {
              $("header .nav1").slideUp(250),
                $("header .search-input").slideDown(250),
                $("header #search").css("display", "none"),
                $("header #searchClose").css("display", "flex"),
                console.log(1);
            }),
            $("header #searchClose").click(function () {
              $("header .nav1").slideDown(250),
                $("header .search-input").slideUp(250),
                $("header #searchClose").css("display", "none"),
                $("header #search").css("display", "inline");
            }))
          : ($(".mob-nav .fa-bars").click(function () {
              $("header .top-box .nav-box .right nav").slideToggle(),
                $(this).css("display", "none"),
                $(".mob-nav .fa-close").css("display", "inline-block");
            }),
            $(".mob-nav .fa-close").click(function () {
              $("header .top-box .nav-box .right nav").slideToggle(),
                $(this).css("display", "none"),
                $(".mob-nav .fa-bars").css("display", "inline-block");
            }),
            $("header .top-box .nav-box .right nav ul.nav1 > li > a").click(
              function () {
                $(this).parent().children(".show-box").slideToggle();
              }
            ),
            $(".search-box").click(function () {
              $(".search-input").slideDown(250), $("input").focus();
            }),
            $(document).keyup(function (e) {
              13 == e.keyCode && $(".search-input").slideUp(250);
            }),
            console.log("小于1200")),
        $(".has-children2 > a").click(function () {
          $(".has-children2>ul").slideToggle();
        });
      var n = [];
      null == JSON.parse(localStorage.getItem("shopCar")) &&
        localStorage.setItem("shopCar", JSON.stringify([]));
      var s = new ((function () {
        function e() {
          !(function (e, o) {
            if (!(e instanceof o))
              throw new TypeError("Cannot call a class as a function");
          })(this, e),
            console.log("初始化 shopCar"),
            this.view(),
            this.count(),
            this.isNullView();
        }
        var o, t, a;
        return (
          (o = e),
          (t = [
            {
              key: "isNullView",
              value: function () {
                var e = JSON.parse(localStorage.getItem("shopCar"));
                console.log(e.length),
                  0 == e
                    ? (console.log("null"),
                      $(".shop-car").css("display", "none"))
                    : $(".shop-car").css("display", "");
              },
            },
            {
              key: "addItem",
              value: function (o) {
                var t = this;
                $.getJSON("./js/products.json", function (e) {
                  this.data = e;
                  e = this.data.find(function (e) {
                    return e.id == o;
                  });
                  (n = JSON.parse(localStorage.getItem("shopCar"))).push(e),
                    localStorage.setItem("shopCar", JSON.stringify(n)),
                    t.count(),
                    t.view();
                });
              },
            },
            {
              key: "removeItem",
              value: function (o) {
                console.log("删除事件");
                var e = JSON.parse(localStorage.getItem("shopCar")),
                  t = e.findIndex(function (e) {
                    return e.id == o;
                  });
                e.splice(t, 1),
                  localStorage.setItem("shopCar", JSON.stringify(e)),
                  this.count(),
                  this.view(o);
              },
            },
            {
              key: "view",
              value: function () {
                var e =
                  0 < arguments.length && void 0 !== arguments[0]
                    ? arguments[0]
                    : null;
                $(".shop-car ul").text("");
                var o,
                  t,
                  a = JSON.parse(localStorage.getItem("shopCar"));
                a.map(function (e) {
                  $(".shop-car ul").append(
                    '\n                 <li data-id="'
                      .concat(
                        e.id,
                        '">\n                     <div class="left"><img src="./img/'
                      )
                      .concat(
                        e.src,
                        '" alt=""></div>\n                     <div class="center">'
                      )
                      .concat(
                        e.title,
                        '</div>\n                     <div class="right"><i class="fa fa-times" aria-hidden="true"></i></div>\n                 </li>\n                 '
                      )
                  );
                }),
                  0 < a.length
                    ? null != e
                      ? (console.log("删除id", e),
                        (o = $(".item-products button")),
                        $(o[e - 1])
                          .children("span")
                          .children("i")
                          .addClass("visibility"),
                        $(o[e - 1]).css("background", "black"),
                        console.log("变黑"))
                      : (console.log("初始化刷新"),
                        (t = $(".item-products button")),
                        a.map(function (e) {
                          console.log(e.id),
                            $(t[e.id - 1])
                              .children("span")
                              .children("i")
                              .removeClass("visibility"),
                            $(t[e.id - 1]).css("background", "#cc1616"),
                            console.log("变红");
                        }))
                    : ((a = $(".item-products button")),
                      console.log("小于0", a),
                      a.each(function (e, o) {
                        console.log("each", o),
                          console.log("变黑"),
                          $(o).css("background", "black"),
                          $(o)
                            .children("span")
                            .children("i")
                            .addClass("visibility");
                      }));
                var n = $(".shop-car ul li");
                $(".shop-car ul li").map(function (o) {
                  console.log("添加事件开始"),
                    $(n[o])
                      .children(".right")
                      .click(function () {
                        var e = $(n[o]).attr("data-id");
                        s.removeItem(e), console.log("被删除的点击事件");
                      });
                }),
                  this.isNullView();
              },
            },
            {
              key: "count",
              value: function () {
                var e = 0,
                  o = JSON.parse(localStorage.getItem("shopCar"));
                o != [] && (e = o.length), $(".buy .count").text(e);
              },
            },
            {
              key: "clear",
              value: function () {
                localStorage.setItem("shopCar", JSON.stringify([])),
                  this.count(),
                  this.view();
              },
            },
          ]) && i(o.prototype, t),
          a && i(o, a),
          e
        );
      })())();
      $(".item-products ul li button").click(function () {
        var e = $(this).children("span").children("i");
        e.toggleClass("visibility");
        var o = $(this).attr("data-id"),
          t = JSON.parse(localStorage.getItem("shopCar"));
        e.hasClass("visibility")
          ? s.removeItem(o)
          : t.length < 5
          ? s.addItem(o)
          : (e.toggleClass("visibility"), toastr.warning("max is 5!"));
      }),
        $(".shop-car .clear").click(function () {
          s.clear();
        });
    });
  new Swiper(".swiper-index", {
    autoplay: !0,
    loop: !0,
    pagination: {
      el: ".swiper-pagination",
      currentClass: "my-pagination-current",
    },
    navigation: {
      nextEl: ".swiper-button-next",
      prevEl: ".swiper-button-prev",
    },
  });
  var e = {},
    e =
      1213 < $(document).width()
        ? {
            loop: !1,
            slidesPerView: 3,
            spaceBetween: 30,
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev",
            },
            scrollbar: { el: ".swiper-scrollbar" },
          }
        : {
            loop: !1,
            slidesPerView: 1,
            pagination: { el: ".swiper-pagination" },
            navigation: {
              nextEl: ".swiper-button-next",
              prevEl: ".swiper-button-prev",
            },
            scrollbar: { el: ".swiper-scrollbar" },
            on: {
              slideChangeTransitionStart: function () {
                console.log(this.activeIndex);
                var e = $(".swiper-slide").length;
                $("#index-count").text(
                  "".concat(this.activeIndex + 1, "/").concat(e)
                );
              },
            },
          },
    o = $(".swiper-slide").length;
  $("#index-count").text("1/".concat(o));
  new Swiper(".swiper-products-details", e);
  $(
    ".productsDetails-article .swiper-products-details .swiper-slide img"
  ).hover(function () {
    var e = $(this).attr("src"),
      o = $(".productsDetails-article .details section.left .img > img"),
      t = $(".productsDetails-article .details section.left .img .big img");
    o.attr("src", e), t.attr("src", e);
  });
  var t = 20;
  function a(e, o) {
    var t = "",
      a =
        '<span class="fy-d"></span><span class="fy-d"></span><span class="fy-d"></span>';
    function n(e) {
      t +=
        o == e
          ? '<span class="fy-y selected" >' + o + "</span>"
          : '<a  class="fy-y" onclick="pageClick(this)">' + e + "</a>";
    }
    if (e <= 10) for (var s = 1; s <= e; s++) n(s);
    else if (o <= 4) {
      for (s = 1; s <= 5; s++) n(s);
      (t += a), n(e);
    } else if (e - 4 < o) {
      n(1), (t += a);
      for (s = e - 4; s <= e; s++) n(s);
    } else {
      n(1), (t += a);
      for (s = o - 1; s <= o + 1; s++) n(s);
      (t += a), n(e);
    }
    (t =
      1 < o && 1 < e
        ? '<a href="#start" class="previous" onclick="first()">First</a><a href="#-1" class="previous" onclick="previous()">Prev</a>' +
          t
        : '<a href="#start" class="previous">First</a><a href="#-1" class="previous">Prev</a>' +
          t),
      (t +=
        o < e && 1 < e
          ? '<a href="#+1" class="next" onclick="next()">Next</a><a href="#end" class="next" onclick="last()">Last</a>'
          : '<a href="#+1" class="next">Next</a><a href="#end" class="next" onclick="last()">Last</a>'),
      (t += '<span class="fy-count">'.concat(o, "/").concat(e, "</span>")),
      $(".rb_bottom").html(t),
      console.log("宽度", document.documentElement.clientWidth),
      document.documentElement.clientWidth;
  }
  $(function () {
    a(t, 1);
  });
